<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .parent {
      height: 200px;
      width: 200px;
      background-color: aqua;
    }

    .parent::before {
      content: '';
      display: block;
      width: 100px;
      height: 1px;
      background-color: red;
      position: absolute;
    }

    .child {
      height: 100px;
      width: 100px;
      background-color: blue;
      position: relative;
    }

    .child::before {
      content: '';
      display: block;
      width: 100px;
      height: 1px;
      background-color: red;
      position: absolute;
      left: -50px;
      top: 50%;
      transform: translateY(-50%);
    }
  </style>
</head>

<body>
  <div class="parent">
    p
    <div class=child>
      c
    </div>
  </div>
</body>

</html>